const Koa = require('koa');
const route = require('koa-route');
const app = new Koa();
var cors = require('koa2-cors'); 
app.use(cors());   
const login = ctx => {
  ctx.response.type = 'html';
  ctx.response.body ={'name':'123'};
};

const main = ctx => {
  ctx.response.body = 'Hello World';
};

app.use(route.get('/', main));
app.use(route.get('/login', login));
app.listen(8020);